package com.company.cloud.mall.modules.app.controller.req;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import org.springframework.util.StringUtils;

import com.company.cloud.common.bean.BaseParam;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class OrderRefundsApplyParam extends BaseParam {

	@ApiModelProperty(value = "订单明细ID", required = true)
	@NotNull(message = "#订订单明细ID不能为空")
	private Integer orderItemId;

	@ApiModelProperty(value = "货物状态（已到货、未到货【YN】", required = true)
	@NotEmpty(message = "#货物状态不能为空")
	private String productState;

	@ApiModelProperty(value = "退款原因", required = true)
	@NotEmpty(message = "#退款原因不能为空")
	private String reason;

	@ApiModelProperty(value = "退款金额", required = true)
	@NotNull(message = "#退款金额不能为空")
	private BigDecimal fund;

	@ApiModelProperty(value = "退款说明")
	private String memo;

	@ApiModelProperty(value = "退款凭证")
	private List<String> certificate;

	public void addCertificate(String item) {
		if (this.certificate == null) {
			this.certificate = new ArrayList<String>();
		}
		if (!StringUtils.isEmpty(item)) {
			this.certificate.add(item);
		}
	}

}
